package com.zkzx.wlhy.adaptor.controller.order;

import com.zkzx.common.freight.command.OrderCommand;
import com.zkzx.common.freight.model.OrderVO;
import com.zkzx.wlhy.adaptor.service.order.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author young Email:yanghui@zkraising.com
 * @description
 * @company 北京中科智兴物联科技有限公司 @版权所有
 * @since 2021年05月19日 16时56分
 */
@RestController
@Validated
@Api( tags="运单信息")
@RequestMapping(value = "/orders")
public class OrderController {


    @Autowired
    private OrderService orderService;

    @PostMapping("/{id}")
    @ResponseStatus(HttpStatus.CREATED)
    @ApiOperation(value = "新增运单信息", notes = "新增运单信息")
    public OrderCommand add(@PathVariable("id") Integer id, @RequestBody @Valid OrderVO oder) {
        return orderService.add(id,oder);
    }



    @GetMapping("/{id}")
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "获取订单详细", notes = "获取订单详细")
    public OrderCommand getById(@PathVariable("id") Integer id, @RequestParam("waybillId") String waybillId) {
//        ResultVO resultVO = whOrderFeign.get(waybillId);
        return null;
    }
}
